<template>
    <div>
        <div v-mybbb="'red'">222</div>
        <div v-mybbb="whichColor">222</div>
        <div v-myccc="'green'">333</div>
    </div>
</template>

<script setup>
const whichColor = 'orange'
//必须以v开头,第二个字母大写
const vMybbb = (el,binding) => {
    el.style.background = binding.value
}
const vMyccc = (el,binding) => {
    el.style.background = binding.value
}
</script>